﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataStructures
{
	public class ElementEnumerable<Element, Tree, TreeList> : BaseEnumerable<Element, Tree, TreeList, Element>
		where Tree : IBaseTree<Element, Tree, TreeList>
		where TreeList : IBaseTreeList<Element, Tree, TreeList>
	{
		#region ctors
		public ElementEnumerable(Tree parent) : base(parent) { }
		#endregion ctors

		#region methods
		public override Element[] ToArray(TraversalType type)
		{
			List<Element> list = new List<Element>();
			ITreeVisitor<Tree> visitor = new BuildElementListVisitor<Element, Tree, TreeList>(list);
			Traverse(visitor);
			return list.ToArray();
		}
		#endregion methods
	}
}
